package component.util;


import component.border.RoundCornerBorder;

import javax.swing.plaf.BorderUIResource;
import java.awt.*;

public class MaterialBorder {
    //普通边框
    public static final BorderUIResource NORMAL_LINE_BORDER = MaterialBorder.roundLineColorBorder(MaterialColors.GRAY_600,12,1);
    //警告边框
    public static final BorderUIResource WRONG_LINE_BORDER = MaterialBorder.roundLineColorBorder(MaterialColors.RED_600,12,3);
    //聚焦边框
    public static final BorderUIResource FOCUSED_LINE_BORDER = MaterialBorder.roundLineColorBorder(MaterialColors.BLUE_600,12,3);
    //一些颜色边框
    public static final BorderUIResource DARK_LINE_BORDER = MaterialBorder.roundLineColorBorder(MaterialColors.COSMO_BLACK,12,3);
    public static final BorderUIResource OCEAN_LINE_BORDER = MaterialBorder.roundLineColorBorder(MaterialColors.DARKLY_STRONG_BLUE,12,3);
    /**
     * @Description
     * @param colorLine 根据颜色返回边框
     * @return javax.swing.plaf.BorderUIResource
     * @author 孔明浩
     * @Date 2020/3/31
     */
    public static BorderUIResource roundLineColorBorder(Color colorLine){

        if (colorLine == null){
            throw new IllegalArgumentException("colorLine is null");
        }
        return new BorderUIResource(roundLineColorBorder(colorLine, 12));
    }
    /**
     * @Description 根据颜色返回指定宽度的边框
     * @param colorLine 边框颜色
     * @param arch 边框圆角
     * @return javax.swing.plaf.BorderUIResource
     * @author 孔明浩
     * @Date 2020/3/31
     */
    public static BorderUIResource roundLineColorBorder(Color colorLine, int arch){

        if (colorLine == null){
            throw new IllegalArgumentException("colorLine is null");
        }
        return new BorderUIResource(new RoundCornerBorder(arch, colorLine));
    }

    /**
     * @Description 根据颜色返回指定宽度的边框
     * @param colorLine 边框颜色
     * @param arch 边框圆角
     * @param strokeWidth 边框宽度
     * @return javax.swing.plaf.BorderUIResource
     * @author 孔明浩
     * @Date 2020/3/31
     */
    public static BorderUIResource roundLineColorBorder(Color colorLine, int arch, float strokeWidth){
        if (colorLine == null){
            throw new IllegalArgumentException("colorLine is null");
        }
        return new BorderUIResource(new RoundCornerBorder(arch, colorLine, strokeWidth));
    }
}
